package dongze.com.ckdj.adapter;

import java.util.List;

/**
 * Created by fanqwz on 2017/7/21.
 */

public class TypedListItem extends ListItem {
    Type type;
    String id;
    int sort;
    List<Option> options;

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<Option> getOptions() {
        return options;
    }

    public void setOptions(List<Option> options) {
        this.options = options;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public static enum Type {
        TEXT,EDITTEXT,SPINNER,RADIO,PHOTO;

        public static Type getTypeFromData(int  program_type) {
            switch (program_type) {
                case 3:
                    return PHOTO;

                case 2:
                    return EDITTEXT;

                case 1:
                    return RADIO;
//                    return SPINNER;

                default:
                    return TEXT;
            }
        }

        public int toData() {
            switch (this) {
                case PHOTO:
                    return 3;

                case EDITTEXT:
                    return 2;

                case SPINNER:
                    return 1;

                default:
                    return 0;
            }
        }
    }

    public static class Option {
        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getDislayname() {
            return dislayname;
        }

        public void setDislayname(String dislayname) {
            this.dislayname = dislayname;
        }

        String value;
        String dislayname;
    }
}
